/**
 * React Native App with PrintProvider 完整示例
 */

import React from 'react'
import { SafeAreaView, ScrollView, StyleSheet } from 'react-native'
import { PrintProvider } from 'react-native-log-printer'
import { DirectUsageExample, HookUsageExample } from './BasicUsage'

// App入口组件
const App = () => {
  // Print配置
  const printConfig = {
    serverUrl: 'http://192.168.1.100:3000', // 替换为你的服务器IP
    enableRemoteLogging: true,
    enableConsoleLogging: true,
    maxLocalLogs: 1000,
    autoSendInterval: 0, // 立即发送，设置为大于0的值启用批量发送
  }

  return (
    <PrintProvider config={printConfig}>
      <SafeAreaView style={styles.container}>
        <ScrollView style={styles.scrollView}>
          {/* 直接使用Print实例的组件 */}
          <DirectUsageExample />

          {/* 使用Hook的组件 */}
          <HookUsageExample />
        </ScrollView>
      </SafeAreaView>
    </PrintProvider>
  )
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#f5f5f5',
  },
  scrollView: {
    flex: 1,
  },
})

export default App
